<?php

class Model_Ps_Ordercarrier extends Zend_Db_Table_Abstract {

	protected $_name = 'ps_order_carrier';
	protected $_adaptor = 'db_remote';
	protected $_primary = 'id_order_carrier';

	public function getOrdercarrier( $idOrderCarrier){

		$row = $this->fetchRow("`id_order` = ". $idOrderCarrier);
		if(!$row) return false;
		return $row->toArray();

	}

	public function addOrdercarrier( $idOrder , $idCarrier , $idOrderInvoice , $weight , $shippingCostTaxExcl , $shippingCostTaxIncl , $trackingNumber , $dateAdd){

		$data = array(
					
				"id_order" =>  $idOrder ,
				"id_carrier" =>  $idCarrier ,
				"id_order_invoice" =>  $idOrderInvoice ,
				"weight" =>  $weight ,
				"shipping_cost_tax_excl" =>  $shippingCostTaxExcl ,
				"shipping_cost_tax_incl" =>  $shippingCostTaxIncl ,
				"tracking_number" =>  $trackingNumber ,
				"date_add" =>  $dateAdd

		);
		$this->insert($data);

	}

	public function updateOrdercarrier(  $idOrderCarrier ,  $idOrder , $idCarrier , $idOrderInvoice , $weight , $shippingCostTaxExcl , $shippingCostTaxIncl , $trackingNumber , $dateAdd){
		$data = array(
					
				"id_order" =>  $idOrder ,
				"id_carrier" =>  $idCarrier ,
				"id_order_invoice" =>  $idOrderInvoice ,
				"weight" =>  $weight ,
				"shipping_cost_tax_excl" =>  $shippingCostTaxExcl ,
				"shipping_cost_tax_incl" =>  $shippingCostTaxIncl ,
				"tracking_number" =>  $trackingNumber ,
				"date_add" =>  $dateAdd

		);
			
		$this->update($data,"`id_order_carrier` = ". $idOrderCarrier);
	}

	public function deleteOrdercarrier( $idOrderCarrier){

		$this->delete("`id_order_carrier` = ". $idOrderCarrier);

	}

	public function listAll(){

		$rows =$this->fetchAll("1","id_order_carrier DESC ");
		if(!$rows) return false;
		return $rows->toArray();

	}
}


?>